Why do I get syntax error: invalid arithmetic operator in a line with a valid syntax